﻿// <copyright file="StringTag.cs" company="Signal Processing Lab, Wuhan University">
// Copyright (c) 2009-2010 All Right Reserved
// </copyright>
// <author>Xinping Deng</author>
// <email>dentoby@gmail.com</email>
// <date>2010-4</date>
// <summary>This is part of Image.NET project.</summary>

namespace SPLWHU.Core
{
    using System;
    using System.Collections.Generic;

    /// <summary>
    /// The <see cref="Tag"/> with a value of string type.
    /// </summary>
    public class StringTag : Tag<string>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="StringTag"/> class.
        /// </summary>
        /// <param name="name">The name of this tag.</param>
        public StringTag(string name)
            : base(name)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="StringTag"/> class.
        /// </summary>
        /// <param name="name">The name of this tag.</param>
        /// <param name="value">The value to be set</param>
        public StringTag(string name, string value)
            : base(name, value)
        {
        }

        /// <summary>
        /// Converts the value of this instance to text.
        /// </summary>
        /// <returns>Converted text representing the value.</returns>
        public override string ValueToText()
        {
            return this.Value;
        }

        /// <summary>
        /// Parses the value of this instance from text.
        /// </summary>
        /// <param name="text">The text to be parsed to generate value.</param>
        public override void ValueFromText(string text)
        {
            this.Value = text.Trim();
        }
    }
}
